<extend name="Public/layout"/>
<block name="head">
<script src="__PUBLIC__js/baishi.js"></script>
<link rel="stylesheet" href="__PUBLIC__css/person-index.css">
<link rel="stylesheet" href="__PUBLIC__css/baishi.css">

<style type="text/css">
.footer{
  display: none;
}
</style>
</block>
    
   <block name="main">
    <div class="container">
      <div class="title">
        <div class="title-banner">
          <img src="__PUBLIC__images/person_banner.png">
        </div>
        <div class="title-person clearfix">
		
          <div class="per-img">
            <img src="{$user.url_img}" height="130" width="130">
          </div>
          <div class="per-name">
            <h4>{:msubstr($user[nickname],0,6)}</h4>
          </div>
          <div class="per-btn">
            <a <if condition="$_SESSION['user']['id'] gt 0">href="/Home/Im/talk/id/{$user.id}"<else/>onclick="isnologin()"</if> class="per-chat">聊天</a>
            <if condition="$user.role eq 2">
              <if condition="$is_fans eq 1">
                <a class="per-master" >已拜师</a>

                <else/>
                <a class="per-master"  <notempty name="Think.session.user.id">  onclick="master('{$r_info.id}','{$user.nickname}','{$user.id}','{$user_name}')"<else/>onclick="isnologin()"</notempty> >拜师</a>

              </if>
          </if>
          </div>
        </div>
        <div class="title-have">
          <if condition="$user.role eq 2"><p class="apprentice">徒弟<span>{$r_info.fans_count}</span></p></if>
          <!-- <p class="master">师父<span>{$sf_count}</span></p> -->
        </div>
        <if condition="$user.role eq 2">
        <div class="title-ex">
          <p class="year">网贷投资<span>{$r_info.year}年</span></p>
          <p class="boom">踩雷次数<span>{$r_info.pit_num}雷</span></p>
          <p class="plat">投资平台<span>{$r_info.platform_num}家</span></p>
        </div>
        </if>
      </div>

<!-- 观点or红包 -->
      <div class="content">
        <if condition="$user.role eq 2">
        <!-- <div class="tab">
          <p class="viewport tab-active">观点</p>
          <p class="hongbao">红包</p>
        </div> -->
        <div class="tab">
            <ul class="clearfix">
              <li>
                <div>
                  <h4 class="vp tab-active">观点</h4>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="sug">红包</h4>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="cheats">秘籍</h4>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="life">生活</h4>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="group">他的群组</h4>
                </div>
              </li>
            </ul>
          </div>
        <div class="con-detailh" style="display:none">
          <ul>
            <foreach name="packet" item="v">
              <li>
                <div class="red-bag-swiper-container">
                  <div class="swiper-wrapper">
                    <foreach name="v.scheme" item="va">
                      <div class="swiper-slide">
                        <div class="detail-top clearfix">
                          <img src="{$v.circle.logo}">
                          <p class="btn-set"></p>
                          <a href="/Home/Circle/circle_info/id/{$v.platform_info.id}">进入圈子</a>
                        </div>
                        <div class="red-con">
                          <ul>
                            <li>
                              <div class="tody-part">
                                <h4>{$va.yields}%</h4>
                                <p>往期年化</p>
                              </div>
                              <span></span>
                            </li>
                            <li>
                              <div class="tody-part tody-num">
                                <span>最佳</span>
                                <h4>{$va.p_user_award}</h4>
                                <p>首投奖励</p>
                              </div>
                              <span></span>
                            </li>
                            <li>
                              <a <if condition="$_SESSION['user']['id']">href="/Home/Financial/event/id/{$v.platform_info.id}/packet/{$_GET[id]}"<else/>href="/Home/Recommend/m_marketing/recommend_id/{$_GET['id']}/p_id/1"</if> class="tody-part lingqu">
                                <img src="__PUBLIC__images/hongbao2.png">
                                <p class="hongbao2">领取红包</p>
                              </a>
                            </li>
                          </ul>
                        </div>
                      </div>
                   
                    </foreach>
                  </div>
                </div>      
              </li>
            </foreach>
          </ul>
        </div>

      </div>
      </if>
      <!-- 最新动态 -->
      <div class="dynamic">
        <div class="dynamic-title">
          <h4>最新动态</h4>
        </div>
        <div class="dynamic-con">
          
          <ul id="self_trend">
            <notempty name="r">
            <foreach name="r" item="v">
            <li class="clearfix">
              <div class="dy-left">
                <p class="data">{$v.add_time|date="d",###}</p>
                <p class="month">{$v.zh_data_m}</p>
              </div>
              <div class="dy-right">
                <div class="dy-where">
                  <p>在<a>{$v.platname}圈子</a>发表了平台{$v.tage}</p>
                </div>
                <div class="header-bottom">
                  <notempty name="v.tag">
                  <ul>
                    <volist name="v.tag" id="vo" offset="0" length='3'>
                    <li>
                      <span>{$vo}</span>
                    </li>
                    </volist>
                  </ul>
                  
                </notempty>
                </div>
                <div class="dy-btn">
                  <if condition="$v[grade][colligate] eq 1">
 
                    <p class="btn-sug"></p>
             
                  <elseif condition="$v[grade][colligate] eq 2" />
         
                    <p class="btn-set"></p>
                
                  <elseif condition="$v[grade][colligate] eq 3" />
          
                    <p class="btn-pru"></p>
            
                  <elseif condition="$v[grade][colligate] eq 4" />
               
                    <p class="btn-no"></p>
              
                  </if>
                </div>
                <div class="dy-con">
                  <if condition="$v.type eq 1" >
                  <p>{$v.evaluate}</p>
                  <elseif condition="$v.type eq 2" />
                   <p>{$v.announce}</p>
                  <elseif condition="$v.type eq 3" />
                  <p>{$v.content}</p>
                  <elseif condition="$v.type eq 4" />
                  <p>{$v.strength}</p>
                  </if>
                </div>
                <div class="item-left">
                  <if condition="$v.is_praise eq 0">
                    <div class="item-no" onclick="praise(this,{$v.type},'{$v.id}')">
                      <img src="__PUBLIC__images/comment-no.png" height="26" width="28">
                    <else/>
                    <div class="item-good" onclick="praise(this,{$v.type},'{$v.id}')">
                      <img src="__PUBLIC__images/comment-good.png" height="26" width="28">
                    </if>
                    <span>{$v.praise}</span>
                  </div>
                  <a href="javascript:"  onclick="location.href='{$v.url}'" class="item-com">
                    <img src="__PUBLIC__images/comment.png" height="25" width="28">
                    <span>{$v.comment}</span>
                  </a>
                </div>
              </div>
            </li>
          </foreach>
          <else/>
          <img src="__PUBLIC__images/no-shuju.png">
            <p>暂时没有数据</p>
          </notempty>
          </ul>
        
        </div>
      </div>
      <!-- 没有数据敬请期待 -->
          <div class="no-item-wrapper">
            <div class="no-item">
              <img src="__PUBLIC__images/pushercenter-no-item-wrapper.png">
              <p>敬请期待</p>
            </div>
          </div>
        </div>
      
      <notempty name="r">
      <div class="loading clearfix">
        <span class="loading-left"></span>
        <p>加载中</p>
        <span class="loading-right"></span>
      </div>
      <div class="base-line clearfix">
        <span class="base-left"></span>
        <p>我是有底线的</p>
        <span class="base-right"></span>
      </div>
      </notempty>
    </div>


<div class="baishitie">
  
</div>
<div class="suc-mon">
  
</div>


  </block>
  <block name="js">
<script src="__PUBLIC__js/circle.js"></script>
    <script type="text/javascript">
  
                        var  topSwiper = new Swiper(".red-bag-swiper-container", {
                           slidesPerView: 1.24,
                          spaceBetween: 30,
                          observer:true,
                          observeParents:true
                        });
            
            
    $(function(){
    var val = "{$_GET['val']}"
    if(val==1){
     $('.hongbao').click()
    }
  })
      function to_fans(recommend_id,obj,val){
               $(obj).attr('onclick',"")
         $.post('{:U("Recommend/recommend_fllow")}',{
          recommend_id:recommend_id,
          val:val,
         },function(res){
          if(res.err==1){
            layer.open({
                content: res.msg
                ,skin: 'msg'
                ,time: 2
                ,end:function(){location.href='/Home/User/login'}
            });
          }else{
             layer.open({
                content: res.msg
                ,skin: 'msg'
                ,time: 1
                ,end:function(){
                  if(val==1){
                    $(obj).addClass('active');
                    $(obj).text('已拜师')
                    $(obj).attr('onclick',"to_fans("+recommend_id+",this,0)")
                  }else{
                    $(obj).removeClass('active');
                    $(obj).text('拜师')
                    $(obj).attr('onclick',"to_fans("+recommend_id+",this,1)")
                  }
                 
                }
            });
          }
         })
      }

      $('.viewport').click(function() {
        $('.viewport').addClass('tab-active');
        $('.hongbao').removeClass('tab-active');
         $('.con-detail').css('display','block');
        $('.con-detailh').css('display','none');
        $('.dynamic').css('display','block');
      });
      $('.hongbao').click(function() {
        $('.hongbao').addClass('tab-active');
        $('.viewport').removeClass('tab-active');
         $('.con-detailh').css('display','block');
        $('.con-detail').css('display','none');
        $('.dynamic').css('display','none');
      });
       // tab切换
      $('.tab > ul > li > div > h4').click(function(){
        $('.tab > ul > li > div > h4').each(function(i,e){
            $(e).removeClass('tab-active');
        });
        var cName = $(this)[0].className;
        switch(cName){

          case 'vp': $('.con-detail').css('display','block');
                    $('.con-detailh').css('display','none');
                    $('.no-item-wrapper').css('display','none');
                    $('.dynamic').css('display','block')
                   break;
          case 'sug': $('.con-detailh').css('display','block');
                      $('.con-detail').css('display','none');
                      $('.no-item-wrapper').css('display','none');
                      $('.dynamic').css('display','none')
                      break;
          case 'cheats' :  $('.no-item-wrapper').css('display','block');
                          $('.dynamic').css('display','none');
                          $('.con-detail').css('display','none');
                          $('.con-detailh').css('display','none');
                          $('.loading').hide()
                          break;     
          case 'life' :  $('.no-item-wrapper').css('display','block');
                          $('.dynamic').css('display','none');
                          $('.con-detail').css('display','none');
                          $('.con-detailh').css('display','none');
                          $('.loading').hide()
                          break;
          case 'group' :     $('.con-detail').css('display','block');
                    $('.con-detailh').css('display','none');
                    $('.no-item-wrapper').css('display','none');
                    $('.dynamic').css('display','block')
                   break;          
                          
        }
        $(this).addClass('tab-active');
      })
    
     $('.group').click(function(){
        var userid = "{$_SESSION['user']['id']}"
        var referral = "{$_SESSION['user']['referral']}"
        if(!userid){
          isnologin();
          return;
        }
        if(referral=="{$user.id}"){
          location.href="/Home/Im/group/id/"+referral+"/pushid/"+referral
          return
        }
        layer.open({
            content: "拜师之后才可加入投顾群组"
            , btn: ['拜师','取消' ]
            , yes: function (index) {
            layer.closeAll()
              master('{$r_info.id}','{$user.nickname}','{$user.id}','{$user_name}')
            $('.group').removeClass('tab-active');
            $('.vp').addClass('tab-active');
            }, no: function(index){
              layer.closeAll();
              $('.group').removeClass('tab-active');
              $('.vp').addClass('tab-active');
            }
          })
    })
              
      var p = 1;
      var status = 1;
      $(window).scroll(function() {
            if(status==1){
              console.log(status)
               if($(document).scrollTop()==$(document).height()-$(window).height()){
                    $('.loading').css('display','block');
                    $('.base-line').css('display','none');
                      get_more(p)
                      p = p+1;
                }
            }
             
               
      });

      function get_more(p){
        var user_id = "{$_GET['id']}"
        var user = "{$_SESSION['user']['id']}"
        if(user_id == user){
          var is_self=1
        }else{
          var is_self =0
        }
        $.post('/Home/Person/get_more_trend',{
          user_id:user_id,
          is_self:is_self,
          p:p
        },function(res){
            if(res.content){
              $('#self_trend').append(res.content); 
            }else{
              status=0;
              $('.loading').css('display','none');
              $('.base-line').css('display','block');
            }
        })
      }


      function isnologin(){
        layer.open({
                    content: '请先登录！'
                    , skin: 'msg'
                    , time: 1
                    , end: function () {
                        location.href = "/Home/User/login?callback=/Home/Person/center/id/"+{$user.id}
                    }
                });
      }


      // 侧滑删除
      $(document).on("pagecreate",function(){
        $(".chat-list ul li").on("swipeleft",function(){
          $(".chat-list ul li").each(function(i,e){
            $(e).animate({marginLeft:'0rem'},500);
          })
          $(this).animate({marginLeft:'-2rem'},500);
           $('.delete').click(function(){
            $(this).parent('li').animate({marginLeft:'-4rem'},500);
          });
           $('.delete-sure').click(function(){
            $(this).parent('li').remove();
           })

        });
        $(".chat-list ul li").on("swiperight",function(){
          $(this).animate({marginLeft:'0rem'},500);
        });
      });
	var title="{$user.nickname}的个人主页-8号金融街！"
	var desc = '8号金融街精选多家优质平台，稳健赚利息还有首投红包领！'
	var link="http://wei.8hjie.com/Home/Person/center/id/{$user.id}"
	var imgUrl='http://wei.8hjie.com/App/Home/Public/images/chat-icon.png' 
  function praise(obj,type,id){
        var userid = "{$_SESSION['user']['id']}"
         if(!userid){
            layer.open({
                    content: '请先登录！'
                    , skin: 'msg'
                    , time: 1
                    , end: function () {
                        location.href = "/Home/User/login?callback=Home/person/center/id/{$_GET['id']}"
                    }
                });
        }
        if(type==1){
          var postdata = {commentid:id,id:id,type:6}
        }else if(type==2){
          var postdata = {announceid:id,id:id,type:9}
        }else if(type==3){
          var postdata = {opinionid:id,id:id,type:8}
        }else if(type==4){
          var postdata = {depthid:id,id:id,type:7}
        }
        
          $.post('/Home/Praise/ajax_praise',postdata,function(res){
            if(res.err==0){
              $(obj).removeClass('item-no')
              $(obj).addClass('item-good')
              $(obj).find('img').attr('src','/App/Home/Public/images/comment-good.png')
              var num=parseInt($(obj).find('span').text())
              num = num+1
              $(obj).find('span').text(num)
            }else{
              layer.open({
                    content: res.msg
                    , skin: 'msg'
                    , time: 1
                    
              });
            }
          })
        
  }
    </script>
    </block>
